A logical router element (LRE) is a network logical entity operates distributively across different host machines of a datacenter as a L3 virtual distributed router (VDR). A logical switch element (LSE) is a network logical entity that operates distributively across different host machines of a datacenter as a L2 switch. Each host machine operates its own local instance of the LRE as a managed physical routing element (MPRE) for performing L3 packet forwarding for the VMs running on that host. Each host machine also operates its own local instance of the LSE as a managed physical switching element (MPSE) for performing L2 packet forwarding for VMs running on the host. LSEs and LREs therefore make it possible to forward data packets locally (i.e., at the originating hypervisor) without going through a shared physical L3 router or L2 switch.